package com.tarena.lbs.activity.controller;

import com.tarena.lbs.activity.pojo.query.ActivityQuery;
import com.tarena.lbs.base.protocol.exception.BusinessException;
import com.tarena.lbs.base.protocol.model.Result;
import com.tarena.lbs.base.protocol.pager.PageResult;
import com.tarena.lbs.activity.service.ActivityService;
import com.tarena.lbs.activity.pojo.param.ActivityAddParam;
import com.tarena.lbs.activity.pojo.vo.ActivityVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;

/**
 * 活动相关功能接口
 */
@Api(tags = "活动相关功能接口")
@RestController
public class ActivityController {

    private final ActivityService activityService;
    @Autowired
    private ActivityController(ActivityService activityService){
        this.activityService = activityService;
    }

    @ApiOperation("商家活动列表")
    @PostMapping("/admin/marketing/marketingActivity/info/list")
    public Result<PageResult<ActivityVO>> pageList(ActivityQuery query){
        PageResult<ActivityVO> pageResult = activityService.pageList(query);
        return new Result<>(pageResult);
    }

    @ApiOperation("商家活动保存")
    @PostMapping("/admin/marketing/marketingActivity/info/save")
    public Result<Void> activitySave(@RequestBody ActivityAddParam param)
            throws BusinessException, ParseException {

        return Result.success();
    }

    @ApiOperation("商家活动详情")
    @GetMapping("/admin/marketing/marketingActivity/info/detail/{id}")
    public Result<ActivityVO> activityDetail(@PathVariable("id") Integer id)
        throws BusinessException {
        return null;
    }

}
